package com.tdtxdcxm.myparallelview.slice;

import com.tdtxdcxm.myparallelview.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Button;
import ohos.agp.components.Component;
import ohos.agp.components.DirectionalLayout;
import ohos.agp.components.webengine.WebAgent;
import ohos.agp.components.webengine.WebView;


public class DetailSlice extends AbilitySlice {
    private DirectionalLayout englishdetail_rootdl;
    private Button englishdetail_backbut;
    private WebView englishdetail_webview;


    public void initDetailSliceComponents(){
        englishdetail_rootdl = (DirectionalLayout) findComponentById(ResourceTable.Id_englishdetail_rootdl);
        englishdetail_backbut = (Button) findComponentById(ResourceTable.Id_englishdetail_backbut);
        englishdetail_webview = (WebView) findComponentById(ResourceTable.Id_englishdetail_webview);

        englishdetail_backbut.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component component) {
                terminate();
            }
        });

        englishdetail_webview.getWebConfig().setJavaScriptPermit(true);
        englishdetail_webview.setWebAgent(new WebAgent());
        englishdetail_webview.load("https:www.csdn.net/");
    }


    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_english_detailpage);

        initDetailSliceComponents();

    }

    @Override
    public void onActive() {
        super.onActive();
    }

    @Override
    public void onInactive() {
        super.onInactive();
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }

    @Override
    public void onBackground() {
        super.onBackground();
    }

    @Override
    public void onStop() {
        super.onStop();
    }
}
